﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using System.Text;

namespace demo06
{
    class MusicToXML
    {
        public static void MusicListToXML(string outputpath, List<MusicEntry> entries)
        {
            XElement x = new XElement("Music",
                from entry in entries
                orderby entry.ID
                select new XElement("Entry",
                    new XElement("ID",entry.ID),
                    new XElement("Artist", entry.Artist),
                    new XElement("Album", entry.Album),
                    new XElement("Title", entry.Title),
                    new XElement("Location",entry.Location)));
            x.Save(outputpath);
        }
    }
}
